home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / wemdemo4.zip / INFO / ELISP.20 < prev    next >
Text File  |  1994-09-21  |  51KB  |  1,192 lines

  1. Info file elisp, produced by Makeinfo, -*- Text -*- from input file
  2. elisp.texi.
  3.  
  4.    This file documents GNU Emacs Lisp.
  5.  
  6.    This is edition 1.03 of the GNU Emacs Lisp Reference Manual,   for
  7. Emacs Version 18.
  8.  
  9.    Published by the Free Software Foundation, 675 Massachusetts
  10. Avenue,  Cambridge, MA 02139 USA
  11.  
  12.    Copyright (C) 1990 Free Software Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of
  15. this manual provided the copyright notice and this permission notice
  16. are preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Foundation.
  27.  
  28.  
  29. 
  30. File: elisp,  Node: Syntax Tables,  Next: Abbrevs,  Prev: Searching and Matching,  Up: Top
  31.  
  32. Syntax Tables
  33. *************
  34.  
  35.    A "syntax table" provides Emacs with the information that
  36. determines the syntactic use of each character in a buffer.  This
  37. information is used by the parsing commands, the complex movement
  38. commands, and others to determine where words, symbols, and other
  39. syntactic constructs begin and end.
  40.  
  41.    A syntax table is a vector of 256 elements; it contains one entry
  42. for each of the 256 ASCII characters of an 8-bit byte.  Each element
  43. is an integer that encodes the syntax of the character in question.
  44.  
  45.    Syntax tables are used only for moving across text, not for the
  46. GNU Emacs Lisp reader.  GNU Emacs Lisp uses built-in syntactic rules
  47. when reading Lisp expressions, and these rules cannot be changed.
  48.  
  49.    Each buffer has its own major mode, and each major mode has its
  50. own idea of the syntactic class of various characters.  For example,
  51. in Lisp mode, the character `;' begins a comment, but in C mode, it
  52. terminates a statement.  To support these variations, Emacs makes the
  53. choice of syntax table local to the each buffer.  Typically, each
  54. major mode has its own syntax table and installs that table in each
  55. buffer which uses that mode.  Changing this table alters the syntax
  56. in all those buffers as well as in any buffers subsequently put in
  57. that mode.  Occasionally several similar modes share one syntax table.
  58. *Note Example Major Modes::, for an example of how to set up a syntax
  59. table.
  60.  
  61.  * Function: syntax-table-p OBJECT
  62.      This function returns `t' if OBJECT is a vector of length 256
  63.      elements.  This means that the vector may be a syntax table. 
  64.      However, according to this test, any vector of length 256 is
  65.      considered to be a syntax table, no matter what its contents.
  66.  
  67. * Menu:
  68.  
  69. * Syntax Descriptors::       How characters are classified.
  70. * Syntax Table Functions::   How to create, examine and alter syntax tables.
  71. * Parsing Expressions::      Parsing balanced expressions
  72.                                 using the syntax table.
  73. * Standard Syntax Tables::   Syntax tables used by various major modes.
  74. * Syntax Table Internals::   How syntax table information is stored.
  75.  
  76.  
  77. 
  78. File: elisp,  Node: Syntax Descriptors,  Next: Syntax Table Functions,  Prev: Syntax Tables,  Up: Syntax Tables
  79.  
  80. Syntax Descriptors
  81. ==================
  82.  
  83.    This section describes the syntax classes and flags that denote
  84. the syntax of a character, and how they are represented as a "syntax
  85. descriptor", which is a Lisp string that you pass to
  86. `modify-syntax-entry' to specify the desired syntax.
  87.  
  88.    Emacs defines twelve "syntax classes".  Each syntax table contains
  89. a mapping that puts each character into one class.  There is no
  90. necessary relationship between the class of a character in one syntax
  91. table and its class in any other table.
  92.  
  93.    Each class is designated by a mnemonic character which serves as
  94. the name of the class when you need to specify a class.  Usually the
  95. designator character is one which is frequently put in that class;
  96. however, its meaning as a designator is unvarying and independent of
  97. how it is actually classified.
  98.  
  99.    A syntax descriptor is a Lisp string which specifies a syntax
  100. class, a matching character (unused except for parenthesis classes)
  101. and flags.  The first character is the designator for a syntax class.
  102. The second character is the character to match; if it is unused, put
  103. a space there.  Then come the characters for any desired flags.  If
  104. no matching character or flags are needed, one character is sufficient.
  105.  
  106.    Thus, the descriptor for the character `*' in C mode is `. 23'
  107. (i.e., punctuation, matching character slot unused, second character
  108. of a comment-starter, first character of an comment-ender), and the
  109. entry for `/' is `. 14' (i.e., punctuation, matching character slot
  110. unused, first character of a comment-starter, second character of a
  111. comment-ender).
  112.  
  113. * Menu:
  114.  
  115. * Syntax Class Table::      Table of syntax classes.
  116. * Syntax Flags::            Additional flags each character can have.
  117.  
  118.  
  119. 
  120. File: elisp,  Node: Syntax Class Table,  Next: Syntax Flags,  Prev: Syntax Descriptors,  Up: Syntax Descriptors
  121.  
  122. Table of Syntax Classes
  123. -----------------------
  124.  
  125.    Here is a summary of the classes, the characters that stand for
  126. them, their meanings, and examples of their use.
  127.  
  128.  * Syntax class: whitespace character
  129.      "Whitespace characters" (designated with ` ' or `-') separate
  130.      symbols and words from each other.  Typically, whitespace
  131.      characters have no other syntactic use, and multiple whitespace
  132.      characters are syntactically equivalent to one.  Space, tab,
  133.      newline and formfeed are almost always considered whitespace.
  134.  
  135.  * Syntax class: word constituent
  136.      "Word constituents" (designated with `w') are parts of normal
  137.      English words and are typically used in variable and command
  138.      names in programs.  All upper and lower case letters and the
  139.      digits are typically word constituents.
  140.  
  141.  * Syntax class: symbol constituent
  142.      "Symbol constituents" (designated with `_') are the extra
  143.      characters that are used in variable and command names along
  144.      with word constituents.  For example, the symbol constituents
  145.      class is used in Lisp mode to indicate that certain characters
  146.      may be part of symbol names even though they are not part of
  147.      English words.  These characters are `$&*+-_<>'.  In standard C,
  148.      the only non-word-constituent character that is valid in symbols
  149.      is underscore (`_').
  150.  
  151.  * Syntax class: punctuation character
  152.      "Punctuation characters" (`.') are those characters that are
  153.      used as punctuation in English, or are used in some way in a
  154.      programming language to separate symbols from one another.  Most
  155.      programming language modes, including Emacs Lisp mode, have no
  156.      characters in this class since the few characters that are not
  157.      symbol or word constituents all have other uses.
  158.  
  159.  * Syntax class: open parenthesis character
  160.  * Syntax class: close parenthesis character
  161.      Open and close "parenthesis characters" are characters used in
  162.      dissimilar pairs to surround sentences or expressions.  Such a
  163.      grouping is begun with an open parenthesis character and
  164.      terminated with a close.  Each open parenthesis character
  165.      matches a particular close parenthesis character, and vice
  166.      versa.  Normally, Emacs indicates momentarily the matching open
  167.      parenthesis when you insert a close parenthesis.  *Note
  168.      Blinking::.
  169.  
  170.      The class of open parentheses is designated with `(', and that
  171.      of close parentheses with `)'.
  172.  
  173.      In English text, and in C code, the parenthesis pairs are `()',
  174.      `[]', and `{}'.  In Emacs Lisp, the delimiters for lists and
  175.      vectors (`()' and `[]') are classified as parenthesis characters.
  176.  
  177.  * Syntax class: string quote
  178.      "String quote characters" (designated with `"') is used to
  179.      delimit string constants in many languages, including Lisp and
  180.      C.  The same string quote character appears at the beginning and
  181.      the end of a string.  Such quoted strings do not nest.
  182.  
  183.      The parsing facilities of Emacs consider a string as a single
  184.      token.  The usual syntactic meanings of the characters in the
  185.      string are suppressed.
  186.  
  187.      The Lisp modes have two string quote characters: double-quote
  188.      (`"') and vertical bar (`|').  `|' is not used in Emacs Lisp,
  189.      but it is used in Common Lisp.  C also has two string quote
  190.      characters: double-quote for strings, and single-quote (`'') for
  191.      character constants.
  192.  
  193.      English text has no string quote characters because English is
  194.      not a programming language.  Although quotation marks are used
  195.      in English, we do not want them to turn off the usual syntactic
  196.      properties of other characters in the quotation.
  197.  
  198.  * Syntax class: escape
  199.      An "escape character" (designated with `\') starts an escape
  200.      sequence such as is used in C string and character constants. 
  201.      The character `\' belongs to this class in both C and Lisp.  (In
  202.      C, it is used thus only inside strings, but it turns out to
  203.      cause no trouble to treat it this way throughout C code.)
  204.  
  205.  * Syntax class: character quote
  206.      A "character quote character" (designated with `/') quotes the
  207.      following character so that it loses its normal syntactic
  208.      meaning.  This differs from an escape character in that only the
  209.      character immediately following is ever affected.
  210.  
  211.      This class is not currently used in any standard Emacs modes.
  212.  
  213.  * Syntax class: paired delimiter
  214.      "Paired delimiter characters" (designated with `$') are like
  215.      string quote characters except that the syntactic properties of
  216.      the characters between the delimiters are not suppressed.  Only
  217.      TeX mode uses a paired identical delimiter presently--the `$'
  218.      that begins and ends math mode.
  219.  
  220.  * Syntax class: expression prefix
  221.      An "expression prefix operator" (designated with `'') is used
  222.      for syntactic operators that are part of an expression if they
  223.      appear next to one but are not part of an adjoining symbol. 
  224.      These characters in Lisp include the apostrophe, `'' (used for
  225.      quoting), and the comma, `,' (used in macros).
  226.  
  227.  * Syntax class: comment starter
  228.  * Syntax class: comment ender
  229.      The "comment starter" and "comment ender" characters are used in
  230.      different languages to delimit comments.  These classes are
  231.      designated with `<' and `>', respectively.
  232.  
  233.      English text has no comment characters.  In Lisp, the semi-colon
  234.      (`;') starts a comment and a newline or formfeed ends one.
  235.  
  236.  
  237. 
  238. File: elisp,  Node: Syntax Flags,  Prev: Syntax Class Table,  Up: Syntax Descriptors
  239.  
  240. Syntax Flags
  241. ------------
  242.  
  243.    In addition to the classes, entries for characters in a syntax
  244. table can include flags.  There are four possible flags, represented
  245. by the characters `1', `2', `3', and `4'.  All are used to describe
  246. multi-character comment delimiters.  A flag indicates that the
  247. character for which the entry is being made can *also* be part of a
  248. comment sequence, in addition to the syntactic properties associated
  249. with its character class.  The flags are independent of the class and
  250. each other for the sake of characters such as `*' in C mode, which is
  251. a punctuation character, *and* the second character of a
  252. start-of-comment sequence (`/*'), *and* the first character of an
  253. end-of-comment sequence (`*/').
  254.  
  255.    The flags for a character C are:
  256.  
  257.    * `1' means C is the start of a two-character comment start
  258.      sequence.
  259.  
  260.    * `2' means C is the second character of such a sequence.
  261.  
  262.    * `3' means C is the start of a two-character comment end sequence.
  263.  
  264.    * `4' means C is the second character of such a sequence.
  265.  
  266.  
  267. 
  268. File: elisp,  Node: Syntax Table Functions,  Next: Parsing Expressions,  Prev: Syntax Descriptors,  Up: Syntax Tables
  269.  
  270. Syntax Table Functions
  271. ======================
  272.  
  273.    In this section we describe functions for creating, accessing and
  274. altering syntax tables.
  275.  
  276.  * Function: make-syntax-table &optional TABLE
  277.      This function constructs a copy of TABLE and returns it.  If
  278.      TABLE is not supplied (or is `nil'), it returns a copy of the
  279.      current syntax table.  Otherwise, an error is signaled if TABLE
  280.      is not a syntax table.
  281.  
  282.  * Function: copy-syntax-table &optional TABLE
  283.      This function is identical to `make-syntax-table'.
  284.  
  285.  * Command: modify-syntax-entry CHAR SYNTAX-DESCRIPTOR &optional TABLE
  286.      This function sets the syntax entry for CHAR according to
  287.      SYNTAX-DESCRIPTOR.  The syntax is changed only for TABLE, which
  288.      defaults to the current buffer's syntax table, and not in any
  289.      other syntax table.  The argument SYNTAX-DESCRIPTOR specifies
  290.      the desired syntax; this is a string beginning with a class
  291.      designator character, and optionally containing a matching
  292.      character and flags as well.  *Note Syntax Descriptors::.
  293.  
  294.      This function always returns `nil'.  The old syntax information
  295.      in the table for this character is discarded.
  296.  
  297.      An error is signaled if the first character of the syntax
  298.      descriptor is not one of the twelve syntax class designator
  299.      characters.  An error is also signaled if CHAR is not a character.
  300.  
  301.      Examples:
  302.  
  303.           ;; Put the space character in class whitespace.
  304.           (modify-syntax-entry ?\  " ")
  305.                => nil
  306.           
  307.           ;; Make `$' an open parenthesis character,
  308.           ;; with `^' as its matching close.
  309.           (modify-syntax-entry ?$ "(^")
  310.                => nil
  311.           ;; Make `^' a close parenthesis character,
  312.           ;; with `$' as its matching open.
  313.           (modify-syntax-entry ?^ ")$")
  314.                => nil
  315.           
  316.           ;; Make `/' a punctuation character,
  317.           ;; the first character of a start-comment sequence,
  318.           ;; and the second character of an end-comment sequence.
  319.           ;; This is used in C mode.
  320.           (modify-syntax-entry ?/ ".13")
  321.                => nil
  322.  
  323.  * Function: char-syntax CHARACTER
  324.      This function returns the syntax class of CHARACTER, represented
  325.      by its mnemonic designator character.  This *only* returns the
  326.      class, not any matching parenthesis or flags.
  327.  
  328.      An error is signaled if CHAR is not a character.
  329.  
  330.      The first example shows that the syntax class of space is
  331.      whitespace (represented by a space).  The second example shows
  332.      that the syntax of `/' is punctuation in C-mode.  This does not
  333.      show the fact that it is also a comment sequence character.  The
  334.      third example shows that open parenthesis is in the class of
  335.      open parentheses.  This does not show the fact that it has a
  336.      matching character, `)'.
  337.  
  338.           (char-to-string (char-syntax ?\ ))
  339.                => " "
  340.           
  341.           (char-to-string (char-syntax ?/))
  342.                => "."
  343.           
  344.           (char-to-string (char-syntax ?\())
  345.                => "("
  346.  
  347.  * Function: set-syntax-table TABLE
  348.      This function makes TABLE the syntax table for the current buffer.
  349.      It returns TABLE.
  350.  
  351.  * Function: syntax-table
  352.      This function returns the current syntax table, which is the
  353.      table for the current buffer.
  354.  
  355.  * command: describe-syntax
  356.      This function describes the syntax specifications of the current
  357.      syntax table.  It makes a listing in the `*Help*' buffer, and
  358.      then pops up a window to display it.  It returns `nil'.
  359.  
  360.      A portion of a description is shown here:
  361.  
  362.           (describe-syntax)
  363.                => nil
  364.           
  365.           ---------- Buffer: *Help* ----------
  366.           C-q             \       which means: escape
  367.           C-r .. C-_              which means: whitespace
  368.           !               .       which means: punctuation
  369.           (               ()      which means: open, matches )
  370.           )               )(      which means: close, matches (
  371.           * .. +          _       which means: symbol
  372.           ,               .       which means: punctuation
  373.           -               _       which means: symbol
  374.           .               .       which means: punctuation
  375.           /               . 13    which means: punctuation,
  376.                     is the first character of a comment-start sequence,
  377.                     is the first character of a comment-end sequence
  378.           0 .. 9          w       which means: word
  379.           ---------- Buffer: *Help* ----------
  380.  
  381.  
  382. 
  383. File: elisp,  Node: Parsing Expressions,  Next: Standard Syntax Tables,  Prev: Syntax Table Functions,  Up: Syntax Tables
  384.  
  385. Parsing and Moving Over Balanced Expressions
  386. ============================================
  387.  
  388.    Here are several functions for parsing and scanning balanced
  389. expressions.  The syntax table controls the interpretation of
  390. characters, so these functions can be used for Lisp expressions when
  391. in Lisp mode and for C expressions when in C mode.  *Note List
  392. Motion::, for convenient higher-level functions for moving over
  393. balanced expressions.
  394.  
  395.  * Function: parse-partial-sexp START LIMIT &optional TARGET-DEPTH
  396.           STOP-BEFORE STATE
  397.      This function parses an expression in the current buffer
  398.      starting at START, not scanning past LIMIT.  Parsing stops at
  399.      LIMIT or when certain criteria described below are met; point is
  400.      set to the location where parsing stops.  The value returned is
  401.      a description of the status of the parse at the point where it
  402.      stops.
  403.  
  404.      Normally, START is assumed to be the top level of an expression
  405.      to be parsed, such as the beginning of a function definition. 
  406.      Alternatively, you might wish to resume parsing in the middle of
  407.      an expression.  To do this, you must provide a STATE argument
  408.      that describes the initial status of parsing.  If STATE is
  409.      omitted (or `nil'), parsing assumes that START is the beginning
  410.      of a new parse at level 0.
  411.  
  412.      If the third argument TARGET-DEPTH is non-`nil', parsing stops
  413.      if the depth in parentheses becomes equal to TARGET-DEPTH.  The
  414.      depth starts at 0, or at whatever is given in STATE.
  415.  
  416.      If the fourth argument STOP-BEFORE is non-`nil', parsing stops
  417.      when it comes to any character that starts a sexp.
  418.  
  419.      The fifth argument STATE is a seven-element list of the same
  420.      form as the value of this function, described below.  The return
  421.      value of one call may be used to initialize the state of the
  422.      parse on another call to `parse-partial-sexp'.
  423.  
  424.      The result is a list of seven elements describing the final
  425.      state of the parse:
  426.  
  427.        1. The depth in parentheses, starting at 0.
  428.  
  429.        2. The character position of the start of the innermost
  430.           containing parenthetical grouping; `nil' if none.
  431.  
  432.        3. The character position of the start of the last complete
  433.           subexpression terminated; `nil' if none.
  434.  
  435.        4. Non-`nil' if inside a string.  (It is the character that
  436.           will terminate the string.)
  437.  
  438.        5. `t' if inside a comment.
  439.  
  440.        6. `t' if point is just after a quote character.
  441.  
  442.        7. The minimum parenthesis depth encountered during this scan.
  443.  
  444.      Elements 1, 4, 5, and 6 are significant in the argument STATE.
  445.  
  446.      This function is used to determine how to indent lines in
  447.      programs written in languages that have nested parentheses.
  448.  
  449.  * Function: scan-lists FROM COUNT DEPTH
  450.      This function scans forward COUNT balanced parenthetical
  451.      groupings from character number FROM.  It returns the character
  452.      number of the position thus found.
  453.  
  454.      If DEPTH is nonzero, parenthesis depth counting begins from that
  455.      value.  The only candidates for stopping are places where the
  456.      depth in parentheses becomes zero; `scan-lists' counts COUNT
  457.      such places and then stops.  Thus, a positive value for DEPTH
  458.      means go out levels of parenthesis.
  459.  
  460.      Comments are ignored if `parse-sexp-ignore-comments' is non-`nil'.
  461.  
  462.      If the beginning or end of the buffer (or its accessible
  463.      portion) is reached and the depth is not zero, an `end-of-file'
  464.      error is signaled.  If the depth is zero but the count is not
  465.      used up, `nil' is returned.
  466.  
  467.  * Function: scan-sexps FROM COUNT
  468.      Scan from character number FROM by COUNT balanced expressions. 
  469.      It returns the character number of the position thus found.
  470.  
  471.      Comments are ignored if `parse-sexp-ignore-comments' is non-`nil'.
  472.  
  473.      If the beginning or end of (the accessible part of) the buffer
  474.      is reached in the middle of a parenthetical grouping, an
  475.      `end-of-file' error is signaled.  If the beginning or end is
  476.      reached between groupings but before count is used up, `nil' is
  477.      returned.
  478.  
  479.  * Function: backward-prefix-chars
  480.      This function moves point backward over any number of chars with
  481.      expression prefix syntax.
  482.  
  483.  * Variable: parse-sexp-ignore-comments
  484.      If the value is non-`nil', then comments are treated as
  485.      whitespace by the functions in this section and by `forward-sexp'.
  486.  
  487.      This works only when the comment terminator is something like
  488.      `*/', and appears only to end a comment.  If comments are
  489.      terminated by newlines, you must make this variable `nil', since
  490.      not every newline is the end of a comment.  (In version 19, this
  491.      limitation is removed.)
  492.  
  493.  
  494. 
  495. File: elisp,  Node: Standard Syntax Tables,  Next: Syntax Table Internals,  Prev: Parsing Expressions,  Up: Syntax Tables
  496.  
  497. Some Standard Syntax Tables
  498. ===========================
  499.  
  500.    Each of the major modes in Emacs has its own syntax table.  Here
  501. are several of them:
  502.  
  503.  * Function: standard-syntax-table
  504.      This function returns the standard syntax table, which is the
  505.      syntax table used in Fundamental mode.
  506.  
  507.  * Variable: text-mode-syntax-table
  508.      The value of this variable is the syntax table used in Text mode.
  509.  
  510.  * Variable: c-mode-syntax-table
  511.      The value of this variable is the syntax table in use in C-mode
  512.      buffers.
  513.  
  514.  * Variable: emacs-lisp-mode-syntax-table
  515.      The value of this variable is the syntax table used in Emacs
  516.      Lisp mode by editing commands.  (It has no effect on the Lisp
  517.      `read' function.)
  518.  
  519.  
  520. 
  521. File: elisp,  Node: Syntax Table Internals,  Prev: Standard Syntax Tables,  Up: Syntax Tables
  522.  
  523. Syntax Table Internals
  524. ======================
  525.  
  526.    Each element of a syntax table is an integer that translates into
  527. the full meaning of the entry: class, possible matching character,
  528. and flags.  However, it is not common for a programmer to work with
  529. the entries directly in this form since the Lisp-level syntax table
  530. functions usually work with syntax descriptors (*note Syntax
  531. Descriptors::.).
  532.  
  533.    The low 8 bits of each element of a syntax table indicates the
  534. syntax class.
  535.  
  536. Integer
  537.      Class
  538.  
  539. 0
  540.      whitespace
  541.  
  542. 1
  543.      punctuation
  544.  
  545. 2
  546.      word
  547.  
  548. 3
  549.      symbol
  550.  
  551. 4
  552.      open parenthesis
  553.  
  554. 5
  555.      close parenthesis
  556.  
  557. 6
  558.      expression prefix
  559.  
  560. 7
  561.      string quote
  562.  
  563. 8
  564.      paired delimiter
  565.  
  566. 9
  567.      escape
  568.  
  569. 10
  570.      character quote
  571.  
  572. 11
  573.      comment-start
  574.  
  575. 12
  576.      comment-end
  577.  
  578.    The next 8 bits are the matching opposite parenthesis (if the
  579. character has parenthesis syntax); otherwise, they are not meaningful.
  580. The next 4 bits are the flags.
  581.  
  582.  
  583. 
  584. File: elisp,  Node: Abbrevs,  Next: Processes,  Prev: Syntax Tables,  Up: Top
  585.  
  586. Abbrevs And Abbrev Expansion
  587. ****************************
  588.  
  589.    An abbreviation or "abbrev" is a string of characters that may be
  590. expanded to a longer string.  The user can insert the abbrev string
  591. and find it replaced automatically with the expansion of the abbrev. 
  592. This saves typing.
  593.  
  594.    The set of abbrevs currently in effect is recorded in an "abbrev
  595. table".  Each buffer has a local abbrev table, but normally all
  596. buffers in the same major mode share one abbrev table.  There is also
  597. a global abbrev table.  Normally both are used.
  598.  
  599.    An abbrev table is represented as an obarray containing a symbol
  600. for each abbreviation.  The symbol's name is the abbreviation.  Its
  601. value is the expansion; its function definition is the hook; its
  602. property list cell contains the use count, the number of times the
  603. abbreviation has been expanded.  Because these symbols are not
  604. inturned in the usual obarray, they will never appear as the result
  605. of reading a Lisp expression; in fact, they will never be used except
  606. by the code that handles abbrevs.  Therefore, it is safe to use them
  607. in an extremely nonstandard way.  *Note Creating Symbols::.
  608.  
  609.    For the user-level commands for abbrevs, see *Note : (emacs)Abbrevs.
  610.  
  611. * Menu:
  612.  
  613. * Abbrev Mode::                 Setting up Emacs for abbreviation.
  614. * Tables: Abbrev Tables.        Creating and working with abbrev tables.
  615. * Defining Abbrevs::            Specifying abbreviations and their expansions.
  616. * Files: Abbrev Files.          Saving abbrevs in files.
  617. * Expansion: Abbrev Expansion.  Controlling expansion; expansion subroutines.
  618. * Standard Abbrev Tables::      Abbrev tables used by various major modes.
  619.  
  620.  
  621. 
  622. File: elisp,  Node: Abbrev Mode,  Next: Abbrev Tables,  Prev: Abbrevs,  Up: Abbrevs
  623.  
  624. Setting Up Abbrev Mode
  625. ======================
  626.  
  627.    Abbrev mode is a minor mode controlled by the value of the
  628. variable `abbrev-mode'.
  629.  
  630.  * Variable: abbrev-mode
  631.      A non-`nil' value of this variable turns on the automatic
  632.      expansion of abbrevs when their abbreviations are inserted into
  633.      a buffer.  If the value is `nil', abbrevs may be defined, but
  634.      they are not expanded automatically.
  635.  
  636.      This variable automatically becomes local when set in any fashion.
  637.  
  638.  * Variable: default-abbrev-mode
  639.      This is the value `abbrev-mode' for buffers that do not override
  640.      it.  This is the same as `(default-value 'abbrev-mode)'.
  641.  
  642.  
  643. 
  644. File: elisp,  Node: Abbrev Tables,  Next: Defining Abbrevs,  Prev: Abbrev Mode,  Up: Abbrevs
  645.  
  646. Abbrev Tables
  647. =============
  648.  
  649.    This section describes how to create and manipulate abbrev tables.
  650.  
  651.  * Function: make-abbrev-table
  652.      This function creates and returns a new, empty abbrev table--an
  653.      obarray containing no symbols.  It is a vector filled with `nil's.
  654.  
  655.  * Function: clear-abbrev-table TABLE
  656.      This function undefines all the abbrevs in abbrev table TABLE,
  657.      leaving it empty.  The function returns `nil'.
  658.  
  659.  * Function: define-abbrev-table TABNAME DEFINITIONS
  660.      This function defines TABNAME (a symbol) as an abbrev table
  661.      name, i.e., as a variable whose value is an abbrev table.  It
  662.      defines abbrevs in the table according to DEFINITIONS, a list of
  663.      elements of the form `(ABBREVNAME EXPANSION HOOK USECOUNT)'. 
  664.      The value is always `nil'.
  665.  
  666.  * Variable: abbrev-table-name-list
  667.      This is a list of symbols whose values are abbrev tables. 
  668.      `define-abbrev-table' adds the new abbrev table name to this list.
  669.  
  670.  * Function: insert-abbrev-table-description NAME HUMAN
  671.      This function inserts before point a description of the abbrev
  672.      table named NAME.  The argument NAME is a symbol whose value is
  673.      an abbrev table.  The value is always `nil'.
  674.  
  675.      If HUMAN is non-`nil', a human-oriented description is inserted.
  676.      Otherwise the description is a Lisp expression--a call to
  677.      `define-abbrev-table' which would define NAME exactly as it is
  678.      currently defined.
  679.  
  680.  
  681. 
  682. File: elisp,  Node: Defining Abbrevs,  Next: Abbrev Files,  Prev: Abbrev Tables,  Up: Abbrevs
  683.  
  684. Defining Abbrevs
  685. ================
  686.  
  687.    These functions define an abbrev in a specified abbrev table. 
  688. `define-abbrev' is the low-level basic function, while `add-abbrev'
  689. is used by commands that ask for information from the user.
  690.  
  691.  * Function: add-abbrev TABLE TYPE ARG
  692.      This function adds an abbreviation to abbrev table TABLE.  The
  693.      argument TYPE is a string describing in English the kind of
  694.      abbrev this will be (typically, `"global"' or
  695.      `"mode-specific"'); this is used in prompting the user.  The
  696.      argument ARG is the number of words in the expansion.
  697.  
  698.      The return value is the symbol which internally represents the
  699.      new abbrev, or `nil' if the user declines to redefine an
  700.      existing abbrev.
  701.  
  702.  * Function: define-abbrev TABLE NAME EXPANSION HOOK
  703.      This function defines an abbrev in TABLE named NAME, to expand
  704.      to EXPANSION, and call HOOK.  The return value is an uninterned
  705.      symbol which represents the abbrev inside Emacs; its name is NAME.
  706.  
  707.      The argument NAME should be a string.  The argument EXPANSION
  708.      should be a string, or `nil', to undefine the abbrev.
  709.  
  710.      The argument HOOK is a function or `nil'.  If HOOK is non-`nil',
  711.      then it is called with no arguments after the abbrev is replaced
  712.      with EXPANSION; point is located at the end of EXPANSION.
  713.  
  714.      The use count of the abbrev is initialized to zero.
  715.  
  716.  * User Option: only-global-abbrevs
  717.      If this variable is non-`nil', it means that the user plans to
  718.      use global abbrevs only.  This tells the commands that define
  719.      mode-specific abbrevs to define global ones instead.  This
  720.      variable does not alter the functioning of the functions in this
  721.      section; it is examined by their callers.
  722.  
  723.  
  724. 
  725. File: elisp,  Node: Abbrev Files,  Next: Abbrev Expansion,  Prev: Defining Abbrevs,  Up: Abbrevs
  726.  
  727. Saving Abbrevs in Files
  728. =======================
  729.  
  730.    A file of saved abbrev definitions is actually a file of Lisp code.
  731. The abbrevs are saved in the form of a Lisp program to define the
  732. same abbrev tables with the same contents.  Therefore, you can load
  733. the file with `load' (*note How Programs Do Loading::.).  However,
  734. the function `quietly-read-abbrev-file' is provided as a more
  735. convenient interface.
  736.  
  737.    User-level facilities such as `save-some-buffers' can save abbrevs
  738. in a file automatically, under the control of variables described here.
  739.  
  740.  * User Option: abbrev-file-name
  741.      This is the default file name for reading and saving abbrevs.
  742.  
  743.  * Function: quietly-read-abbrev-file FILENAME
  744.      This function reads abbrev definitions from a file named
  745.      FILENAME, previously written with `write-abbrev-file'.  If
  746.      FILENAME is `nil', the file specified in `abbrev-file-name' is
  747.      used.  `save-abbrevs' is set to `t' so that changes will be saved.
  748.  
  749.      This function does not display any messages.  It returns `nil'.
  750.  
  751.  * User Option: save-abbrevs
  752.      A non-`nil' value for `save-abbrev' means that Emacs should save
  753.      abbrevs when files are saved.  `abbrev-file-name' specifies the
  754.      file to save the abbrevs in.
  755.  
  756.  * Variable: abbrevs-changed
  757.      This variable is set non-`nil' by defining or altering any 
  758.      abbrevs.  This serves as a flag for various Emacs commands to
  759.      offer to save your abbrevs.
  760.  
  761.  * Command: write-abbrev-file FILENAME
  762.      Save all abbrev definitions, in all abbrev tables, in the file
  763.      FILENAME as a Lisp program which will define the same abbrevs
  764.      when loaded.  This function returns `nil'.
  765.  
  766.  
  767. 
  768. File: elisp,  Node: Abbrev Expansion,  Next: Standard Abbrev Tables,  Prev: Abbrev Files,  Up: Abbrevs
  769.  
  770. Looking Up and Expanding Abbreviations
  771. ======================================
  772.  
  773.    Abbrevs are usually expanded by commands for interactive use, or
  774. automatically by `self-insert'.  This section describes the
  775. subroutines used in writing such functions, as well as the variables
  776. they use for communication.
  777.  
  778.  * Function: abbrev-symbol ABBREV TABLE
  779.      This function returns the symbol representing the abbrev named
  780.      ABBREV.  The value returned is `nil' if that abbrev is not
  781.      defined.  The optional second argument TABLE is the abbrev table
  782.      to look it up in.  By default, this function tries first the
  783.      current buffer's local abbrev table, and second the global
  784.      abbrev table.
  785.  
  786.  * User Option: abbrev-all-caps
  787.      When this is set non-`nil', an abbrev entered entirely in upper
  788.      case is expanded using all upper case.  Otherwise, an abbrev
  789.      entered entirely in upper case is expanded by capitalizing each
  790.      word of the expansion.
  791.  
  792.  * Function: abbrev-expansion ABBREV &optional TABLE
  793.      This function returns the string that ABBREV would expand into
  794.      (as defined by the abbrev tables used for the current buffer). 
  795.      The optional argument TABLE specifies the abbrev table to use;
  796.      if it is specified, the abbrev is looked up in that table only.
  797.  
  798.  * Variable: abbrev-start-location
  799.      This is the buffer position for `expand-abbrev' to use as the
  800.      start of the next abbrev to be expanded.  `nil' means use the
  801.      word before point as the abbrev.  `abbrev-start-location' is set
  802.      to `nil' each time `expand-abbrev' is called.  This variable is
  803.      set by `abbrev-prefix-mark'.
  804.  
  805.  * Variable: abbrev-start-location-buffer
  806.      The value of this variable is the buffer for which
  807.      `abbrev-start-location' has been set.  Trying to expand an
  808.      abbrev in any other buffer clears `abbrev-start-location'.  This
  809.      variable is set by `abbrev-prefix-mark'.
  810.  
  811.  * Variable: last-abbrev
  812.      This is the `abbrev-symbol' of the last abbrev expanded.  This
  813.      information is left by `expand-abbrev' for the sake of the
  814.      `unexpand-abbrev' command.
  815.  
  816.  * Variable: last-abbrev-location
  817.      This is the location of the last abbrev expanded.  This contains
  818.      information left by `expand-abbrev' for the sake of the
  819.      `unexpand-abbrev' command.
  820.  
  821.  * Variable: last-abbrev-text
  822.      This is the exact expansion  text of the last abbrev expanded,
  823.      as results from case conversion.  Its value is `nil' if the
  824.      abbrev has already been unexpanded.  This contains information
  825.      left by `expand-abbrev' for the sake of the `unexpand-abbrev'
  826.      command.
  827.  
  828.  
  829. 
  830. File: elisp,  Node: Standard Abbrev Tables,  Prev: Abbrev Expansion,  Up: Abbrevs
  831.  
  832. Standard Abbrev Tables
  833. ======================
  834.  
  835.    Here we list the variables that hold the abbrev tables for the
  836. preloaded major modes of Emacs.
  837.  
  838.  * Variable: global-abbrev-table
  839.      This is the abbrev table for mode-independent abbrevs.  The
  840.      abbrevs defined in it apply to all buffers.  Each buffer may
  841.      also have a local abbrev table, whose abbrev definitions take
  842.      precedence over those in the global table.
  843.  
  844.  * Variable: local-abbrev-table
  845.      The value of this buffer-local variable is the (mode-specific)
  846.      abbreviation table of the current buffer.
  847.  
  848.  * Variable: fundamental-mode-abbrev-table
  849.      This is the local abbrev table used in Fundamental mode.  It is
  850.      the local abbrev table in all buffers in Fundamental mode.
  851.  
  852.  * Variable: text-mode-abbrev-table
  853.      This is the local abbrev table used in Text mode.
  854.  
  855.  * Variable: c-mode-abbrev-table
  856.      This is the local abbrev table used in C mode.
  857.  
  858.  * Variable: lisp-mode-abbrev-table
  859.      This is the local abbrev table used in Lisp mode and Emacs Lisp
  860.      mode.
  861.  
  862.  
  863. 
  864. File: elisp,  Node: Processes,  Next: System Interface,  Prev: Abbrevs,  Up: Top
  865.  
  866. Processes
  867. *********
  868.  
  869.    In the terminology of operating systems, a "process" is a space in
  870. which a program can execute.  Emacs runs in a process.  Emacs Lisp
  871. programs can invoke other programs in processes of their own.  These
  872. are called "subprocesses" or "child processes" of the Emacs process,
  873. which is their "parent process".
  874.  
  875.    A subprocess of Emacs may be "synchronous" or "asynchronous". 
  876. depending on how it is created.  When you create a synchronous
  877. subprocess, the Lisp program waits for the subprocess to terminate
  878. before continuing execution.  When you create an asynchronous
  879. subprocess, it can run in parallel with the Lisp program.  This kind
  880. of subprocess is represented within Emacs by a Lisp object which is
  881. also called a "process".  Lisp programs can use this object to
  882. communicate with the subprocess or to control it.  For example, you
  883. can send signals, obtain status information, receive output from the
  884. process, or send input to it.
  885.  
  886.  * Function: processp OBJECT
  887.      This function returns `t' if OBJECT is a process, `nil' otherwise.
  888.  
  889. * Menu:
  890.  
  891. * Subprocess Creation::      Functions that start subprocesses.
  892. * Synchronous Processes::    Details of using synchronous subprocesses.
  893. * Asynchronous Processes::   Starting up an asynchronous subprocess.
  894. * Deleting Processes::       Eliminating an asynchronous subprocess.
  895. * Process Information::      Accessing run-status and other attributes.
  896. * Input to Processes::       Sending input to an asynchronous subprocess.
  897. * Signals to Processes::     Stopping, continuing or interrupting
  898.                                an asynchronous subprocess.
  899. * Output from Processes::    Collecting output from an asynchronous subprocess.
  900. * Sentinels::                Sentinels run when process run-status changes.
  901. * VMS Subprocesses::         VMS has completely different subprocess features.
  902. * TCP::                      Opening network connections.
  903.  
  904.  
  905. 
  906. File: elisp,  Node: Subprocess Creation,  Next: Synchronous Processes,  Prev: Processes,  Up: Processes
  907.  
  908. Functions that Create Subprocesses
  909. ==================================
  910.  
  911.    There are three functions that create a new Unix subprocess in
  912. which to run a program.  One of them, `start-process', creates an
  913. asynchronous process and returns a process object (*note Asynchronous
  914. Processes::.).  The other two, `call-process' and
  915. `call-process-region', create a synchronous process and do not return
  916. a process object (*note Synchronous Processes::.).
  917.  
  918.    Synchronous and asynchronous processes are explained in following
  919. sections.  Since the three functions are all called in a similar
  920. fashion, their common arguments are described here.
  921.  
  922.    In all cases, the program to be run is specified with the
  923. function's PROGRAM argument.  An error is signaled if the file is not
  924. found or cannot be executed.  The actual file containing the program
  925. is found by following normal Unix rules: if an absolute file name is
  926. given, then the program must be found in the specified file; if a
  927. relative file name is given, then the directories in `exec-path' are
  928. searched sequentially for a suitable file.  The variable `exec-path'
  929. is initialized when Emacs is started, based on the value of the
  930. environment variable `PATH'.  The standard Unix abbreviations, `~',
  931. `.', and `..', are interpreted as usual, but environment variable
  932. substitutions (`$HOME', etc.) are not recognized; use
  933. `substitute-in-file-name' to perform them (*note File Name
  934. Expansion::.).
  935.  
  936.    Each of the subprocess-creating functions has a BUFFER-OR-NAME
  937. argument which specifies where the standard output from the program
  938. will go.  If BUFFER-OR-NAME is `nil', then the output will be
  939. discarded (by directing it to `/dev/null') unless a filter function
  940. is specified to handle it.  (*Note Filter Functions::, and *Note
  941. Streams::.)  Normally, you should avoid having multiple processes
  942. send output to the same buffer because the outputs will be intermixed
  943. randomly.
  944.  
  945.    All three of the subprocess-creating functions have a `&rest'
  946. argument, ARGS.  The ARGS must all be strings, and they are supplied
  947. to PROGRAM as separate command line arguments.  Wildcard characters
  948. and other shell constructs are not allowed in these strings, since
  949. they are passed directly to the specified program.  *Note:* the
  950. argument PROGRAM contains only the name of the program; it may not
  951. contain any command-line arguments.  Such arguments must be provided
  952. via ARGS.
  953.  
  954.    The subprocess gets its current directory from the value of
  955. `default-directory' (*note File Name Expansion::.).
  956.  
  957.    The subprocess inherits its environment from Emacs; but you can
  958. specify overrides for it with `process-environment'.
  959.  
  960.  * Variable: process-environment
  961.      This variable is a list of strings to append to the environment
  962.      of processes as they are created.  Each string assigns a value
  963.      to a shell environment variable.  (This applies both to
  964.      asynchronous and synchronous processes.)
  965.  
  966.           process-environment
  967.           => ("l=/usr/stanford/lib/gnuemacs/lisp"
  968.               "PATH=.:/user/lewis/bin:/usr/class:/nfsusr/local/bin"
  969.               "USER=lewis" 
  970.               "TERM=ibmapa16" 
  971.               "SHELL=/bin/csh"
  972.               "HOME=/user/lewis")
  973.  
  974.  * Variable: exec-directory
  975.      The value of this variable is the name of a directory (a string)
  976.      that contains programs that come with GNU Emacs, that are
  977.      intended for Emacs to invoke.  The program `loadst' is an
  978.      example of such a program; it is used by the `display-time'
  979.      command to print the current time (and certain other
  980.      information) once per minute.
  981.  
  982.      The default value is the name of a directory whose name ends in
  983.      `etc'.  We call the directory `emacs/etc', since its name
  984.      usually ends that way.  We sometimes refer to "the directory
  985.      `emacs/etc'," when strictly speaking we ought to say, "the
  986.      directory named by the variable `exec-directory'."  Most of the
  987.      time, there is no difference.
  988.  
  989.  * User Option: exec-path
  990.      The value of this variable is a list of directories to search
  991.      for programs to run in subprocesses.  Each element is either the
  992.      name of a directory (i.e., a string), or `nil', which stands for
  993.      the default directory (which is the value of `default-directory').
  994.  
  995.      The value of `exec-path' is used by `call-process' and
  996.      `start-process' when the PROGRAM argument is not an absolute
  997.      file name.
  998.  
  999.  
  1000. 
  1001. File: elisp,  Node: Synchronous Processes,  Next: Asynchronous Processes,  Prev: Subprocess Creation,  Up: Processes
  1002.  
  1003. Creating a Synchronous Process
  1004. ==============================
  1005.  
  1006.    After a "synchronous process" is created, Emacs waits for the
  1007. process to terminate before continuing.  Starting Dired is an example
  1008. of this: it runs `ls' in a synchronous process, then modifies the
  1009. output slightly.  Because the process is synchronous, the entire
  1010. directory listing arrives in the buffer before Emacs tries to do
  1011. anything with it.
  1012.  
  1013.    While Emacs waits for the synchronous subprocess to terminate, the
  1014. user can quit by typing `C-g', and the process is killed by sending
  1015. it a `SIGKILL' signal.  *Note Quitting::.
  1016.  
  1017.    The synchronous subprocess functions return `nil' in version 18. 
  1018. In version 19, they will return an indication of how the process
  1019. terminated.
  1020.  
  1021.  * Function: call-process PROGRAM &optional INFILE BUFFER-OR-NAME
  1022.           DISPLAY &rest ARGS
  1023.      This function calls PROGRAM in a separate process and waits for
  1024.      it to finish.
  1025.  
  1026.      The standard input for the process comes from file INFILE if
  1027.      INFILE is not `nil' and from `/dev/null' otherwise.  The process
  1028.      output gets inserted in buffer BUFFER-OR-NAME before point, if
  1029.      that argument names a buffer.  If BUFFER-OR-NAME is `t', output
  1030.      is sent to the current buffer; if BUFFER-OR-NAME is `nil',
  1031.      output is discarded.
  1032.  
  1033.      If BUFFER-OR-NAME is the integer 0, the output is discarded and
  1034.      `call-process' returns immediately.  In this case, the process
  1035.      is not truly synchronous, since it can run in parallel with
  1036.      Emacs; but you can think of it as synchronous in that Emacs is
  1037.      essentially finished with the subprocess as soon as this
  1038.      function returns.
  1039.  
  1040.      If DISPLAY is non-`nil', then `call-process' redisplays the
  1041.      buffer as output is inserted.  Otherwise the function does no
  1042.      redisplay, and the results become visible on the screen only
  1043.      when Emacs redisplays that buffer in the normal course of events.
  1044.  
  1045.      The remaining arguments, ARGS, are strings that are supplied as
  1046.      the command line arguments for the program.
  1047.  
  1048.      The examples below are both run with the buffer `foo' current.
  1049.  
  1050.           (call-process "pwd" nil t)
  1051.                => nil
  1052.           
  1053.           ---------- Buffer: foo ----------
  1054.           /usr/user/lewis/manual
  1055.           ---------- Buffer: foo ----------
  1056.           
  1057.           (call-process "grep" nil "bar" nil "lewis" "/etc/passwd")
  1058.                => nil
  1059.           
  1060.           ---------- Buffer: bar ----------
  1061.           lewis:5LTsHm66CSWKg:398:21:Bil Lewis:/user/lewis:/bin/csh
  1062.           
  1063.           ---------- Buffer: bar ----------
  1064.  
  1065.      The `dired-readin' function contains a good example of the use
  1066.      of `call-process':
  1067.  
  1068.           (call-process "ls" nil buffer nil dired-listing-switches dirname)
  1069.  
  1070.  * Function: call-process-region START END PROGRAM &optional DELETE
  1071.           BUFFER-OR-NAME DISPLAY &rest ARGS
  1072.      This function sends the text between START to END as standard
  1073.      input to a process running PROGRAM.  It deletes the text sent if
  1074.      DELETE is non-`nil', which may be useful when the output is
  1075.      going to be inserted back in the current buffer.
  1076.  
  1077.      If BUFFER-OR-NAME names a buffer, the output is inserted in that
  1078.      buffer at point.  If BUFFER-OR-NAME is `t', the output is sent
  1079.      to the current buffer.  If BUFFER-OR-NAME is `nil', the output
  1080.      is discarded.  If BUFFER-OR-NAME is the integer 0, the output is
  1081.      discarded and `call-process' returns immediately, as in
  1082.      `call-process'.
  1083.  
  1084.      If DISPLAY is non-`nil', then `call-process-region' redisplays
  1085.      the buffer as output is inserted.  Otherwise the function does
  1086.      no redisplay, and the results become visible on the screen only
  1087.      when Emacs redisplays that buffer in the normal course of events.
  1088.  
  1089.      The remaining arguments, ARGS, are strings that are supplied as
  1090.      the command line arguments for the program.
  1091.  
  1092.      In the following example, we use `call-process-region' to run
  1093.      the `cat' utility, with standard input being the first five
  1094.      characters in buffer `foo' (the word `input').  `cat' copies its
  1095.      standard input into its standard output.  Since the argument
  1096.      BUFFER-OR-NAME is `t', this output is inserted in the current
  1097.      buffer.
  1098.  
  1099.           ---------- Buffer: foo ----------
  1100.           input-!-
  1101.           ---------- Buffer: foo ----------
  1102.           
  1103.           (call-process-region 1 6 "cat" nil t)
  1104.                => nil
  1105.           
  1106.           ---------- Buffer: foo ----------
  1107.           inputinput-!-
  1108.           ---------- Buffer: foo ----------
  1109.  
  1110.      The `shell-command-on-region' command uses `call-process-region'
  1111.      like this:
  1112.  
  1113.           (call-process-region start end 
  1114.                                shell-file-name    ; Name of program.
  1115.                                nil                ; Do not delete region.
  1116.                                buffer             ; Send output to `buffer'.
  1117.                                nil                ; No redisplay during output.
  1118.                                "-c" command)      ; Arguments for the shell.
  1119.  
  1120.  
  1121. 
  1122. File: elisp,  Node: Asynchronous Processes,  Next: Deleting Processes,  Prev: Synchronous Processes,  Up: Processes
  1123.  
  1124. Creating an Asynchronous Process
  1125. ================================
  1126.  
  1127.    After an "asynchronous process" is created, Emacs and the Lisp
  1128. program can continue running immediately.  The process may thereafter
  1129. run in parallel with Emacs, and the two may communicate with each
  1130. other using the functions described in following sections.  Here we
  1131. describe how to create an asynchronous process, with `start-process'.
  1132.  
  1133.  * Function: start-process NAME BUFFER-OR-NAME PROGRAM &rest ARGS
  1134.      This function creates a new asynchronous subprocess and starts
  1135.      the program PROGRAM running in it.  It returns a process object
  1136.      that stands for the new subprocess for Emacs Lisp programs.  The
  1137.      argument NAME specifies the name for the process object; if a
  1138.      process with this name already exists, then NAME is modified (by
  1139.      adding `<1>', etc.) to be unique.  The buffer BUFFER-OR-NAME is
  1140.      the buffer to associate with the process.
  1141.  
  1142.      The remaining arguments, ARGS, are strings that are supplied as
  1143.      the command line arguments for the program.
  1144.  
  1145.      In the example below, the first process is started and runs
  1146.      (rather, sleeps) for 100 seconds.  Meanwhile, the second process
  1147.      is started, given the name `my-process<1>' for the sake of
  1148.      uniqueness.  It inserts the directory listing at the end of the
  1149.      buffer `foo', before the first process finishes.  Then it
  1150.      finishes, and a message to that effect is inserted in the
  1151.      buffer.  Much later, the first process finishes, and another
  1152.      message is inserted in the buffer for it.
  1153.  
  1154.           (start-process "my-process" "foo" "sleep" "100")
  1155.                => #<process my-process>
  1156.           
  1157.           (start-process "my-process" "foo" "ls" "-l" "/user/lewis/bin")
  1158.                => #<process my-process<1>>
  1159.           
  1160.           ---------- Buffer: foo ----------
  1161.           total 2
  1162.           lrwxrwxrwx  1 lewis          14 Jul 22 10:12 gnuemacs --> /emacs
  1163.           -rwxrwxrwx  1 lewis          19 Jul 30 21:02 lemon
  1164.           
  1165.           Process my-process<1> finished
  1166.           
  1167.           Process my-process finished
  1168.           ---------- Buffer: foo ----------
  1169.  
  1170.  * Variable: process-connection-type
  1171.      This variable controls the type of device used to communicate
  1172.      with asynchronous subprocesses.  If it is `nil', then pipes are
  1173.      used.  If it is `t', then PTYs are used (or pipes if PTYs not
  1174.      supported).
  1175.  
  1176.      PTYs are usually preferable for processes visible to the user,
  1177.      as in Shell mode, because they allow job control (`C-c', `C-z',
  1178.      etc.) to work between the process and its children whereas pipes
  1179.      do not.  For subprocesses used for internal purposes by
  1180.      programs, it is often better to use a pipe, because they are
  1181.      more efficient.  In addition, the total number of PTYs is
  1182.      limited on many systems and it is good not to waste them.
  1183.  
  1184.      The value `process-connection-type' is used when `start-process'
  1185.      is called, so in order to change it for just one call of
  1186.      `start-process', temporarily rebind it with `let'.
  1187.  
  1188.           (let ((process-connection-type nil))  ; Use a pipe.
  1189.             (start-process ...))
  1190.  
  1191.  
  1192.